package com.cat.test.test01;

import java.util.List;
import java.util.stream.IntStream;
import java.util.stream.Stream;

/**
 * @author 曲大人的喵
 * @description
 * @create 2025/10/28 11:22
 * @since JDK17
 */

public class Solution04 {
    public static void main(String[] args) {
        Stream<Integer> stream = Stream.of(1, 2, 3, 4, 5);
//        System.out.println(stream.filter(x -> x % 2 == 0).findFirst());
//        System.out.println(stream.filter(x -> x % 2 == 0).findFirst().orElse(-1));
//        stream.filter(x -> (x & 1) == 0).findFirst().ifPresent(System.out::println);
        System.out.println(IntStream.range(0, 5).anyMatch(x -> x % 2 == 0));
        Stream.of(1, 3, 3, 1, 2, 2, 4, 5, 5).distinct().forEach(System.out::println);
        IntStream.range(1, 6).reduce((x, y) -> x + y).ifPresent(System.out::println);
        IntStream.range(1, 6).reduce(Math::max).ifPresent(System.out::println);
        IntStream.range(1, 6).reduce(Math::min).ifPresent(System.out::println);

    }
}
